package com.tju.ffmpeg

import android.os.Bundle
import androidx.appcompat.app.AppCompatActivity
import androidx.databinding.DataBindingUtil
import com.tju.ffmpeg.databinding.ActivityMainBinding
import com.tju.ffmpeglib.FFmpegNDK

class MainActivity : AppCompatActivity() {
    private val TAG = "MainActivity"

    private val musicUrl = "http://39.106.203.217/static/feng.mp3"
    private val pcmUrl = "http://39.106.203.217/static/feng.pcm"

    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        val binding =
            DataBindingUtil.setContentView<ActivityMainBinding>(this, R.layout.activity_main)

        binding.prepare.setOnClickListener {
            Thread {
                FFmpegNDK.decode(musicUrl)
            }.start()
        }

        binding.playPcm.setOnClickListener {
            Thread {
                FFmpegNDK.playPcm(pcmUrl)
            }.start()
        }

    }


}